/*
 * MediaRender.h
 *
 *  Created on: 2016年3月17日
 *      Author: terry
 */

#ifndef MEDIARENDER_H_
#define MEDIARENDER_H_

#include "MediaStream.h"
#include "TimePoint.h"

namespace av
{


class ReferenceClock
{
public:
	virtual ~ReferenceClock() {}

	//virtual bool isSet() =0;

	//virtual void setRefPoint(int64_t clock, int64_t pts) =0;

	virtual bool getTimePoint(int64_t& clock, int64_t& pts) =0;

};

struct RenderEvent
{
	int event;
	int x;
	int y;
	int which;
	int modifier;
};

class RenderEventSink
{
public:
	virtual ~RenderEventSink() {}

	virtual void onRenderEvent(const RenderEvent& event) = 0;

};


class MediaRender : public ReferenceClock
{
public:
	virtual ~MediaRender() {}

	//virtual int open() =0;

	virtual void close() =0;

	virtual bool isOpen() =0;

	virtual int play() =0;
	virtual int pause() =0;
	virtual void stop() =0;

	virtual int getState() =0;

	virtual void setFormat(const MediaFormat& fmt) =0;

	virtual int write(AVFramePtr frame) =0;

	virtual void flush() =0;

	virtual void setScale(AVRational scale) =0;

    virtual bool setProp(const std::string& name, const std::string& value) =0;

	virtual void setEventSink(RenderEventSink* pSink) =0;

};



}


#endif /* MEDIARENDER_H_ */
